import store from '@/store';
export default {
	methods: {
		getPermission(value) {
			let hasPermissions = true;
			const all_permission = '*:*:*';
			const permissions = store.getters && store.getters.permissions;

			if (value && value instanceof Array && value.length > 0) {
				const permissionFlag = value;

				hasPermissions = permissions.some(permission => {
					return all_permission === permission || permissionFlag.includes(permission);
				});
			} else {
				hasPermissions = false;
				throw new Error(`请设置操作权限标签值`);
			}
			return hasPermissions;
		}
	}
};
